package com.bydq.patrolsystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bydq.patrolsystem.entity.PsPoleInfo;
import com.bydq.patrolsystem.mapper.PsPoleInfoMapper;
import com.bydq.patrolsystem.service.PsPoleInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 写代码是不可能写代码的啦~~
 * @since 2020-05-22
 */
@Service
public class PsPoleInfoServiceImpl extends ServiceImpl<PsPoleInfoMapper, PsPoleInfo> implements PsPoleInfoService {

    @Autowired
    private PsPoleInfoMapper psPoleInfoMapper;


    @Override
    public boolean countByPoleCode(String poleCode) {
        QueryWrapper<PsPoleInfo> qw = new QueryWrapper<>();
        qw.eq("poleCode", poleCode);
        boolean flag = psPoleInfoMapper.selectCount(qw) > 0 ? false : true;

        return flag;
    }

    @Override
    public boolean delByLineId(int lineId) {
        return psPoleInfoMapper.delByLineId(lineId);
    }
}
